<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDeviceInfoTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('deviceInfo', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('userId')->comment('用户id,userAdm表主键');
            //$table->integer('cmpId')->comment('所属公司id,cmpInfo表主键')->index();
            $table->string('idfa')->comment('用户关联设备idfa号码');
            $table->string('deviceName')->comment('设备名称');
            $table->unique('deviceName');
            $table->unique('idfa');
            $table->index('userId');
            $table->integer('createdAt')->comment('创建时间');
            $table->integer('updatedAt')->comment('最后更新时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('deviceInfo');
    }
}
